var webpack = require('webpack')
const path = require('path');
var OpenBrowserPlugin = require('open-browser-webpack-plugin');
module.exports = {
    entry: './public/assets/js/entry.js',
    output: {
        path: __dirname + '/public/assets',
        publicPath: "/assets/",
        filename: 'bundle.js'
    },
    module: {
        rules: [
            {
                test: /\.(js|jsx)$/,
                exclude: /node_modules/,
                use: 'babel-loader',
            },
            {
                test: /\.css$/,
                //exclude: /node_modules/,
                use: ['style-loader', 'css-loader']
            },
        ],
    },
    plugins: [
        new webpack.HotModuleReplacementPlugin(),//热加载插件
        new OpenBrowserPlugin({ url: 'http://127.0.0.1:3000' })
    ],
    resolve: {
        extensions: ['.js', '.jsx']
        // 这里可以使用alias配置项，可以显示的指定我们常用的一些库，避免webpack自己的查找
    },
    devServer: {
        port: 3000,
        hot: true,
        contentBase: './public',
        inline: true//实时刷新
    }
}